<!DOCTYPE html>
<html class="login-bg">
<head>
    <title>后台管理系统--登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- bootstrap -->
    <link href="/assets/admin/css/bootstrap/bootstrap.css" rel="stylesheet"/>
    <link href="/assets/admin/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet"/>

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="/assets/admin/css/compiled/layout.css"/>
    <link rel="stylesheet" type="text/css" href="/assets/admin/css/compiled/elements.css"/>
    <link rel="stylesheet" type="text/css" href="/assets/admin/css/compiled/icons.css"/>

    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="/assets/admin/css/lib/font-awesome.css"/>

    <!-- this page specific styles -->
    <link rel="stylesheet" href="/assets/admin/css/compiled/signin.css" type="text/css" media="screen"/>

    <!-- open sans font -->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,800italic,400,300,600,700,800'
          rel='stylesheet' type='text/css'/>

    <!--[if lt IE 9]>
    <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body onkeydown="keyLogin();">


<!-- background switcher -->
{{--<div class="bg-switch visible-desktop">--}}
{{--<div class="bgs">--}}
{{--<a href="#" data-img="landscape.jpg" class="bg active">--}}
{{--<img src="/assets/admin/img/bgs/landscape.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="blueish.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/blueish.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="7.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/7.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="8.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/8.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="9.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/9.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="10.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/10.jpg" alt="background" />--}}
{{--</a>--}}
{{--<a href="#" data-img="11.jpg" class="bg">--}}
{{--<img src="/assets/admin/img/bgs/11.jpg" alt="background" />--}}
{{--</a>--}}
{{--</div>--}}
{{--</div>--}}


<div class="login-wrapper">
    <a href="#">
        <img class="logo" src="/assets/admin/img/logo-white.png" alt="logo"/>
    </a>

    <div class="box">
        <div class="content-wrap">
            <h6>登录</h6>
            <input class="form-control" type="text" name="account" placeholder="账号">
            <input class="form-control" type="password" name="password" placeholder="密码">
            {{--<a href="#" class="forgot">Forgot password?</a>--}}
            <span style="color:red" node-type="error_msg"></span>
            <div class="remember">
                <input id="remember-me" type="checkbox">
                <label for="remember-me">记住我</label>
            </div>
            <a class="btn-glow primary login" href="javascript:;">登录</a>
        </div>
    </div>

    {{--<div class="no-account">--}}
    {{--<p>Don't have an account?</p>--}}
    {{--<a href="signup.html">Sign up</a>--}}
    {{--</div>--}}
</div>

<!-- scripts -->
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script src="/assets/admin/js/bootstrap.min.js"></script>
<script src="/assets/admin/js/theme.js"></script>

<!-- pre load bg imgs -->
<script type="text/javascript">
    $(function () {
        // bg switcher
        var $btns = $(".bg-switch .bg");
        $btns.click(function (e) {
            e.preventDefault();
            $btns.removeClass("active");
            $(this).addClass("active");
            var bg = $(this).data("img");

            $("html").css("background-image", "url('/assets/admin/img/bgs/" + bg + "')");
        });

    });
    function keyLogin() {
        if (event.keyCode == 13) {
            $('a.login').trigger('click');
        }
    }
    $('a.login').on('click', function () {
        var account = $('input[name="account"]').val();
        var pwd = $('input[name="password"]').val();
        var remember = $('#remember-me:checked').val();
        if ($.trim(account) == '') {
            alert('请输入账号');
            return;
        }
        if ($.trim(pwd) == '') {
            alert('请输入密码');
            return;
        }
        $.post('/admin/sign_in', {account: account, password: pwd, remember: remember}, function (res) {
            if (res.status) {
                console.log(res);
                location.href = "/admin";
            } else {
                $('span[node-type="error_msg"]').text(res.message);
            }
        });
    });
</script>
</body>
</html>